home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr29
/
memsize.zip
/
MUTEX.H
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-04
|
1KB
|
43 lines
/******************************************************************** MUTEX.H
* *
* MUTEX Semaphore Class *
* *
****************************************************************************/
#ifndef MUTEX_H
#define MUTEX_H
class Mutex
{
private:
HMTX Handle ;
public:
Mutex ( PSZ Name )
{
int Status = DosCreateMutexSem ( Name, &Handle, 0, FALSE ) ;
if ( Status )
{
extern VOID Log ( char *Message, ... ) ;
Log ( "MUTEX: Unable to create semaphore '%s'.\r\n", Name ) ;
}
}
~Mutex ( )
{
DosCloseMutexSem ( Handle ) ;
}
int Request ( int Timeout )
{
return ( DosRequestMutexSem ( Handle, Timeout ) ) ;
}
int Release ( )
{
return ( DosReleaseMutexSem ( Handle ) ) ;
}
} ;
#endif